<!--{template common/header_simple_start}-->
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
<link href="{MOD_PATH}/images/market.css?{VERHASH}" rel="stylesheet" media="all">
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
<style>
.app_upgradelist {
	margin: auto;
	padding: 8px;
	border-bottom: 1px solid #f2f2f2;
	position: relative;
}
.app_upgradelist .progess {
	position: absolute;
	top: 0;
	left: 0;
	height: 30px;
	width: 0%;
	height: 100%;
	width: 100%;
}
.app_upgradelist .progess .upgrade_progess {
	background-color: #dff0d8;
	position: absolute;
	width: 0%;
	height: 100%;
}
.app-name-wrapper {
	padding-left: 55px;
	position: relative;
	max-width: 350px;
	min-height: 50px;
}
.app-name-wrapper .appicon {
	position: absolute;
	left: 0;
	top: 2px;
}
.app-name-wrapper .appicon img {
	max-width: 45px;
	max-height: 45px;
	margin: 0;
}
.app-name-wrapper .appname {
	margin: 0;
	line-height: 25px;
}
.app-name-wrapper .appname a {
	color: #000;
	font-weight: 500;
	font-size: 14px;
}
.app-name-wrapper .appdesc {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: #999;
	font-size: 13px;
	cursor: default;
}
.table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td {
	white-space: nowrap;
}
.group-td-wrapper {
	max-width: 320px;
	white-space: normal;
	overflow: hidden;
	text-overflow: ellipsis;
}
.group-td-wrapper>span {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.group-td-wrapper>span>img {
	margin: 0;
	vertical-align: text-bottom;
}
.app-info a {
	color: #999;
}
.app-info .select-info {
	position: absolute;
	left: 30px;
	top: 0;
	display: none;
	background-color: #FFF;
	padding: 5px 10px;
}
.main-header {
	padding: 5px
}
.main-header>div {
	line-height: 34px;
	margin: 0 5px;
}
#update_selected {
	margin-left: 20px;
}
.checkbox-custom {
	margin-bottom: 0;
}
</style>
<!--{template common/header_simple_end}-->
<!--{template common/commer_header}-->
<div class="bs-container clearfix">
  <div class="bs-left-container  clearfix"> 
    <!--{template left}--> 
  </div>
  <div class="left-drager"></div>
  <div class="bs-main-container">
    <div class="all-center-top clearfix">
      <div class="app-info pull-left"> <a href="{BASESCRIPT}?mod=appmarket">{lang total}<span class="num">$total</span>{lang ge}{lang app}</a> 
		 
      </div>
       <div class="pull-right" style="color:#999;line-height: 34px;">{lang manual_install_tip}</div>
    </div>
    <div class="main-content clearfix" >
      <div class="market-container" id="loopcontent" style="min-width:510px;"> 
        <!--{loop $list $value}-->
        <div id="app_div_{$value[mid]}" class="row app_upgradelist" >
          <div id="progess_{$value[mid]}" class="progess"> <span id="upgrade_progess_{$value[mid]}" class="upgrade_progess"></span> </div>
          <div class="col-md-5  col-sm-5 col-xs-5" style="padding-left: 4px;">
            <div class="app-name-wrapper" > <a href="javascript:;" data-href="{$cloudurl}?mod=dzzmarket&op=ajax&do=view&mid=$value[mid]&refer=$refer"  class="appicon view-detail" title="$value[name]"><img src="$value[coverimg]" style="margin:0" /></a>
              <p class="appname"> <a href="javascript:;" data-href="{$cloudurl}?mod=dzzmarket&op=ajax&do=view&mid=$value[mid]&refer=$refer" target="_blank" class="view-detail" title="$value[name]">$value[name]</a> <small class="text-muted" title="{lang version}">$value[version]</small></p>
              <div class="appdesc" title="$value['appdesc']">{eval echo $value[desc_short]?$value[desc_short]:lang('none');}</div>
            </div>
          </div>
          <div class="col-md-2 col-sm-2 col-xs-2">
            <div class="group-td-wrapper">{$value['classid_name']}</div>
          </div>
          <div class="col-md-2 col-sm-2 col-xs-2"> {eval echo formatsize($value[packagesize]);} </div>
          <div class="col-md-3  col-sm-3 col-xs-3"> 
            <!--{if $value[price]>0}-->
            <button class="btn btn-danger"  onclick="showBuyInfo(this,'$value[mid]')" data-href="$cloudurl?mod=dzzmarket&op=ajax&do=getBuyInfo&mid=$value[mid]" title="{lang buy_contract}">{lang buy}</button>
            <!--{else}--> 
				<!--{if $value[package]}--> 
					<!--{if $value["local_appinfo"]}-->
					<btn  class="btn btn-default" disabled style="color: #333;" data-mid="$value['mid']" title="{lang installed}">
					{lang installed}
					</button>
					<!--{else}-->
					<button class="btn btn-success-outline" style="white-space: inherit;" onclick="start_check_install('{MOD_URL}&op=install_app_ajax&operation=check_install&appid=$value[identifier]','{$value[mid]}','{$value[baseinfo]}');" id="upgrade_info_{$value[mid]}">{lang install_onekey}</button>
					<!--{/if}--> 
				<!--{else}--> 
				<a class="btn btn-success-outline view-detail" title="$value[name]" href="javascript:;" data-href="{$cloudurl}?mod=dzzmarket&op=ajax&do=view&mid=$value[mid]" >{lang view_detail}</a> 
				<!--{/if}--> 
            <!--{/if}--> 
          </div>
        </div>
        <!--{/loop}--> 
      </div>
    </div>
    <div id="pageinfo" style="text-align:center;padding:10px;">$multi</div>
  </div>
</div>
<div class="modal in">
  <div class="modal-dialog">
    <div class="modal-content">
    
      <div class="modal-body"> </div>
      <div class="modal-footer" style="text-align: center">
        <button type="button" class="btn btn-dark" data-dismiss="modal">{lang close}</button>
      </div>
    </div>
    <!-- /.modal-content --> 
  </div>
  <!-- /.modal-dialog --> 
</div>
<!-- /.modal --> 
<script type="text/javascript">
	jQuery('.left-drager').leftDrager_layout();
	jQuery('.view-detail').on('click',function(){
		showBuyInfo(this,'modal-lg');
		return false;
	});
	var ajaxurl='{$cloudurl}';
	function showBuyInfo(obj,size){ 
		var url=jQuery(obj).data('href');
		var title=jQuery(obj).attr('title');
		if(size){
			jQuery('.modal .modal-dialog').addClass(size);
		}
		jQuery.get(url,function(html){
			html=html.replace(/src=\"index\.php/ig,'src="$cloudurl');
			console.log(html);
			jQuery('.modal .modal-body').html(html);
		});
		//jQuery('.modal .modal-title').html(title);
		jQuery('.modal').modal('show');
	}
	function getNext(url){
		jQuery.get(url,function(html){
			var li=jQuery('.appitem-next');
			li.replaceWith(html);
		});
	}

	function start_check_install(url,mid,data){ 
			jQuery.ajax({
					type:'post',
					async: true, 
					url:url,
					data:{"baseinfo":data },
					success:function(json){
							//jQuery('#install_button_'+mid).html("&nbsp;");  
							if(json.status==0){
								jQuery('#upgrade_info_'+mid).show().addClass("btn-warning").html(json.msg); 
							}else if(json.status==1){ 
								jQuery('#upgrade_info_'+mid).show().text(json.msg);
								jQuery('#upgrade_progess_'+mid).show().animate({width:json.percent+"%"},json.second,function(){
									startinstsallapp(json.url,mid,data);
								});
							}else{
								window.location.reload();
							}
					} 
			});
	}

	function startinstsallapp(url,mid,data){
		jQuery.ajax({
			type:'post',
			async: true, 
			url:url,
			data:{"baseinfo":data},
			success:function(json){ 
				if(json.status==0){
					jQuery('#upgrade_info_'+mid).addClass("btn-warning").html(json.msg);
				}else{
					jQuery('#upgrade_info_'+mid).text(json.msg);
					jQuery('#upgrade_progess_'+mid).animate({width:json.percent+"%"},json.second,function(){
						startgetinstallcrossorpatchfile(json.url,mid,data);
					});
				}
			} 
		});
	}

	function startgetinstallcrossorpatchfile(url,mid,data){
		jQuery.ajax({
			type:'post',
			async: true, 
			url:url,
			data:{"baseinfo":data},
			success:function(json){ 
				if(json.status==0){ 
					jQuery('#upgrade_info_'+mid).addClass("btn-warning").html(json.msg); 
				}else{
					jQuery('#upgrade_info_'+mid).text(json.msg);
					jQuery('#upgrade_progess_'+mid).animate({width:json.percent+"%"},json.second,function(){
						if(json.step==2){
							startgetinstallcrossorpatchfile(json.url,mid,data);
						}else{ 
							startinstallfile(json.url,mid,data);
						}
					}); 
				}
			} 
		});
	}

	function startinstallfile(url,mid,data){
		jQuery.ajax({
			type:'post',
			async: true, 
			url:url,
			data:{"baseinfo":data},
			success:function(json){ 
				if(json.status==0){ 
					jQuery('#upgrade_info_'+mid).addClass("btn-warning").html(json.msg); 
				}else{
					jQuery('#upgrade_info_'+mid).text(json.msg);
					jQuery('#upgrade_progess_'+mid).animate({width:json.percent+"%"},json.second,function(){
						 if(json.step!=5){
							startinstallfile(json.url,mid,data);
						}else{ 
							installover(json.url,mid,data);
						}
					}); 
				}
			} 
		});
	}

	function installover(url,mid,data){
		jQuery.ajax({
			type:'post',
			async: true, 
			url:url,
			data:{"baseinfo":data},
			success:function(json){ 
				if(json.status==0){ 
					jQuery('#upgrade_info_'+mid).addClass("btn-warning").html(json.msg); 
				}else{
					jQuery('#upgrade_info_'+mid).text(json.msg);
					jQuery('#upgrade_progess_'+mid).css("width","100%");
				}
			} 
		});
	}

	function start_check_upgrade(url,mid){
		jQuery.ajax({
			type:'post',
			async: true, 
			url:url,
			data:{},
			success:function(json){
				jQuery('#upgrade_button_'+mid).html("&nbsp;");  
				if(json.status==0){
					jQuery('#upgrade_info_'+mid).show().text(json.msg);  
				}else{ 
					jQuery('#upgrade_info_'+mid).show().text(json.msg);
					jQuery('#upgrade_progess_'+mid).show().animate({width:json.percent+"%"},json.second,function(){
					startupgrade(json.url,mid);
					});
				}
			} 
		});
	}

	function startupgrade(url,mid){
		jQuery.ajax({
			type:'post',
			async: true, 
			url:url,
			data:{},
			success:function(json){ 
				if(json.status==0){
					jQuery('#upgrade_info_'+mid).text(json.msg); 
				}else{
					jQuery('#upgrade_info_'+mid).text(json.msg);
					jQuery('#upgrade_progess_'+mid).animate({width:json.percent+"%"},json.second,function(){
						startgetcrossorpatchfile(json.url,mid);
					});
				}
			} 
		});
	}

	function startgetcrossorpatchfile(url,mid){
		jQuery.ajax({
			type:'post',
			async: true, 
			url:url,
			data:{},
			success:function(json){ 
				if(json.status==0){ 
					alert( json.msg);
				}else{
					jQuery('#upgrade_info_'+mid).text(json.msg);
					jQuery('#upgrade_progess_'+mid).animate({width:json.percent+"%"},json.second,function(){
						if(json.step==2){
							startgetcrossorpatchfile(json.url,mid);
						}else{
							startupgradefile(json.url,mid);
						}
					}); 
				}
			} 
		});
	}

	function startupgradefile(url,mid){
		jQuery.ajax({
			type:'post',
			async: true, 
			url:url,
			data:{},
			success:function(json){ 
				if(json.status==0){ 
					alert( json.msg);
				}else{
					jQuery('#upgrade_info_'+mid).text(json.msg);
					jQuery('#upgrade_progess_'+mid).animate({width:json.percent+"%"},json.second,function(){
						 if(json.step!=5){
							startupgradefile(json.url,mid);
						}else{
							upgradeover(json.url,mid);
						}
					}); 
				}
			} 
		});
	}

	function upgradeover(url,mid){
		jQuery.ajax({
			type:'post',
			async: true, 
			url:url,
			data:{},
			success:function(json){
				if(json.status==0){ 
					alert( json.msg);
				}else{
					jQuery('#upgrade_progess_'+mid).animate({width:"100%"},300,function(){
						jQuery('#upgrade_progess_'+mid).hide().css("width","0");
						start_check_upgrade(json.url,mid);
					}); 
				}
			} 
		});
	} 
		
</script> 
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script> 
<!--{template common/footer_simple}-->